﻿using System.Collections.Generic;
using System.Linq;

namespace Microsoft.Coding4Fun.TweetCraft.Twitter
{
    internal static class TweetExtensions
    {
        public static Tweet GetLatestTweet(this IEnumerable<Tweet> tweets)
        {
            if (tweets != null)
                return tweets.OrderByDescending(tweet => tweet.DateSent).FirstOrDefault();

            return null;
        }
    }
}
